package com.example.seckillconsumer.feign;

import com.example.seckillconsumer.config.FeignConfig;
import com.example.seckillconsumer.hystrix.SecKillOrderFeignHystrix;
import com.myshop.b2b.commonmodule.Goods;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Set;

/**
 * @author likaiping
 */
@Component
@FeignClient(value = "goods-provider",fallback = SecKillOrderFeignHystrix.class,
        configuration = FeignConfig.class,contextId = "secKillOrderFeign")
public interface SecKillOrderFeign {

    /**
     * 秒杀订单
     * @param goodsname
     * @param number
     * @param price
     * @param userIds
     * @return
     */
    @GetMapping("/insertSecKillOrder")
    public boolean insertSecKillOrder(@RequestParam("goodsname") String goodsname,
                                      @RequestParam("number")int number,
                                      @RequestParam("price")int price,
                                      @RequestParam("userIds") List<Integer> userIds);

    /**
     * 根据商品id查询商品
     * @param gid
     * @return
     */
    @GetMapping("/getOnegid")
    public Goods getOnegid(@RequestParam(value = "gid")int gid);
}
